CREATE TABLE Domains (
	[DomainName] varchar(66) NOT NULL,
	[DomainID] int IDENTITY(1,1) NOT NULL,
	PRIMARY KEY ([DomainID]),
	CONSTRAINT IdxDomainConstraint UNIQUE ([DomainName])	
)
GO

CREATE TABLE UserList (
	[UserID] int IDENTITY(1,1) NOT NULL,
	[Mailbox] varchar(60) NOT NULL,
	[FullName] varchar(100) NOT NULL,
	[MailDir] varchar(255) NOT NULL,
	[Password] varchar(32) NOT NULL,
	[AutoDecode] bit NOT NULL,
	[IsForwarding] bit NOT NULL,
	[AllowAccess] bit NOT NULL,
	[AllowChangeViaEmail] bit NOT NULL,	
	[KeepForwardedMail] bit NOT NULL,
	[HideFromEveryone] bit NOT NULL,
	[EncryptMail] bit NOT NULL,
	[ApplyQuotas] bit NOT NULL,
	[EnableMultiPop] bit NOT NULL,
	[CanModifyGAB] bit NOT NULL,
	[CalendarOnly] bit NOT NULL,
	[MaxMessageCount] int NOT NULL,
	[MaxDiskSpace] int NOT NULL,
	[DomainID] int NOT NULL,
	PRIMARY KEY([Mailbox], [DomainID]),
	CONSTRAINT IdxUserConstraint UNIQUE ([Mailbox], [DomainID]),
	FOREIGN KEY ([DomainID]) REFERENCES Domains
)
GO